package com.corpgovernment.common.apollo;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @ClassName: FlightBookingApollo
 * @description: 国内机票阿波罗配置
 * @author: ezchen
 * @date: Created in 10:19 2020/7/7
 * @Version: 1.0
 **/
@Component
public class FlightApollo extends CommonApollo {

    /**
     * 航班查询获取航班列表异步获取超时时间
     */
    @Value("${flightProductGetTime:20}")
    private Integer flightProductGetTime;
    /**
     * 获取机票差标异步获取超时时间
     */
    @Value("${travelStandardGetTime:10}")
    private Integer travelStandardGetTime;
    /**
     * 航班查询 获取开始数据（聚合方式）异步获取超时时间
     */
    @Value("${switchValueGetTime:10}")
    private Integer switchValueGetTime;
    /**
     * 航班查询 机票订购业务查询异步获取超时时间
     */
    @Value("${supplierCompanyGetTime:10}")
    private Integer supplierCompanyGetTime;
    /**
     * 航班查询异步获取缓存中的数据超时时间
     */
    @Value("${dataFromCacheGetTime:20}")
    private Integer dataFromCacheGetTime;
    /**
     * 航班查询组织异步获取异步获取超时时间
     */
    @Value("${suppliersGetTime:20}")
    private Integer suppliersGetTime;
    /**
     * 停留时间校验 时间/秒
     */
    @Value("${bookTimeout:1200}")
    private Long bookTimeout;

    /**
     * 机票列表缓存时间设置  默认为半小时 1800秒
     */
    @Value("${flight_list_cache_time:1800}")
    private Long flightListCacheTime;
    /**
     * appllo配置的供应商顺序
     */
    @Value("${base_price_supplier_order:}")
    private String basePriceSupplierOrder;
    /**
     * 公司支付后处理控制参数
     */
    @Value("${accnt_operation_code:4}")
    private Integer accntOperationCode;
    /**
     * 个人支付后处理控制参数
     */
    @Value("${ppay_operation_code:5}")
    private Integer ppayOperationCode;
    @Value("${fFPRegister_url:}")
    private String fFPRegisterUrl;

    @Value("${flow_tmpl_pay_type_default:}")
    private String flowTmplPayType;

    @Value("${supplier_code_classification: }")
    private String supplierCodeClassification;

    public String getfFPRegisterUrl() {
        return getAppProperty("fFPRegister_url", "");
    }

    public Long getFlightListCacheTime() {
        return Long.valueOf(getAppProperty("flight_list_cache_time", "1800"));
    }

    public Integer getFlightProductGetTime() {
        return Integer.parseInt(getAppProperty("flightProductGetTime", "20"));
    }

    public Integer getTravelStandardGetTime() {
        return Integer.parseInt(getAppProperty("travelStandardGetTime", "10"));
    }

    public Integer getSwitchValueGetTime() {
        return Integer.parseInt(getAppProperty("switchValueGetTime", "10"));
    }

    public Integer getSupplierCompanyGetTime() {
        return Integer.parseInt(getAppProperty("supplierCompanyGetTime", "10"));
    }

    public Integer getDataFromCacheGetTime() {
        return Integer.parseInt(getAppProperty("dataFromCacheGetTime", "20"));
    }

    public Integer getSuppliersGetTime() {
        return Integer.parseInt(getAppProperty("suppliersGetTime", "20"));
    }

    public Long getBookTimeout() {
        return Long.parseLong(getAppProperty("bookTimeout", "1200"));
    }

    public String getBasePriceSupplierOrder() {
        return getAppProperty("base_price_supplier_order", "");
    }

    public Integer getAccntOperationCode() {
        return Integer.parseInt(getAppProperty("accnt_operation_code", "4"));
    }

    public Integer getPpayOperationCode() {
        return Integer.parseInt(getAppProperty("ppay_operation_code", "5"));
    }

    public String getFlowTmplPayType() {
        return getAppProperty("flow_tmpl_pay_type_default","");
    }

    public String getSupplierCodeClassification(){
        return this.supplierCodeClassification;
    }
}
